package com.joven.shelltest.utils.pdf;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.joven.shelltest.dto.TestDto;

import java.io.FileNotFoundException;

/**
 * @Author wzj
 * @Date 2023-10-08 14:46
 **/
public class PdfTest2 {
    public static void main(String[] args) throws DocumentException, FileNotFoundException, IllegalAccessException {
        TestDto testDto = new TestDto();
        testDto.setTitle("权利人(申请人)");
        testDto.setValue("中国建设银行股份有限公司");

        TestDto testDto1 = new TestDto();
        testDto1.setTitle("义务人");
        testDto1.setValue("张三");

        TestDto testDto2 = new TestDto();
        testDto2.setTitle("坐落");
        testDto2.setValue("衢州市柯城区白云街道");

        TestDto testDto3 = new TestDto();
        testDto3.setTitle("其他");
        String str = String.format("不动产权证书号：330803001012GB01196F00060059%n %n抵押方式：一般抵押%n %n被担保主债权数额：85000%n %n债务履行期限：20230914-20630915");
        testDto3.setValue(str);

        TestDto testDto4 = new TestDto();
        testDto4.setTitle("附记");
        testDto4.setValue("债务人：叶斌");

        PdfBuilder.builder("D:\\image\\test3.pdf")
                .blank()
                .blank()
                .text(10, BaseColor.DARK_GRAY, "浙（2023）衢州市不动产证明第0001718号", 3, 40, null)
                .blank()
                .table(PdfTableBuilder.builder(2, 450, new float[]{150, 300})
                        .row(PdfTableBuilder.PdfCellBuilder.builder().build(Element.ALIGN_LEFT, null), testDto)
                        .row(PdfTableBuilder.PdfCellBuilder.builder().build(Element.ALIGN_LEFT, null), testDto1)
                        .row(PdfTableBuilder.PdfCellBuilder.builder().build(Element.ALIGN_LEFT, null), testDto2)
                        .row(PdfTableBuilder.PdfCellBuilder.builder().build(Element.ALIGN_LEFT, Element.ALIGN_TOP), testDto3)
                        .row(PdfTableBuilder.PdfCellBuilder.builder().build(Element.ALIGN_LEFT, null), testDto4)
                        .build())
                .build();
    }
}
